<?php
//dplayer召唤函数
function dp($url,$as=0){
    if(!empty($as)){
        $nas="'{$as}'";
        $nurl="'{$url}'";
        $wg=$as.'.min.js';
        echo("<div id='dplayer'></div><script src='./assets/{$wg}'></script>");
        echo("<script src='https://cdn.jsdelivr.net/npm/dplayer@1.26.0/dist/DPlayer.min.js'></script>
<script>
const dp = new DPlayer({
    container: document.getElementById('dplayer'),
    video: {
        type:".$nas.",
        url:".$nurl.",
    },
});
</script>");
    }elseif(empty($as)){
       $nurl="'{$url}'";
       echo("<div id='dplayer'></div>
<script src='https://cdn.jsdelivr.net/npm/dplayer@1.26.0/dist/DPlayer.min.js'></script>
<script>
const dp = new DPlayer({
    container: document.getElementById('dplayer'),
    video: {
        url:".$nurl.",
    },
});
</script>");
    }
}
//aplayer召唤函数
function ap($name,$url,$artist="未知",$cover="http://api.btstu.cn/sjtx/api.php?lx=c2&format=images"){
    $nname="'{$name}'";
    $nurl="'{$url}'";
    $nartist="'{$artist}'";
    $ncover="'{$cover}'";
    echo("<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css'>
<div id='aplayer'></div>
<script src='https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js'></script>");
    echo("<script>const ap = new APlayer({
    container: document.getElementById('aplayer'),
    audio: [{
        name: ".$nname.",
        artist: ".$nartist.",
        url: ".$nurl.",
        cover: ".$ncover."
    }]
});</script>");
}
?>